

data = [
	[1, 2, 3, 4],
	[5, 6, 7, 8],
	[9, 10, 11, 12],
	[13, 14, 15, 16]
]

n = len(data)
m = len(data[0])

vector = [0,n-1]
pos = [0,n-1]

for i in range(n * m):
	print(data[vector[0]][vector[1]],end=",")
	# print(f"坐标:{vector[0]},{vector[1]}")
	
	if vector[0] >= n-1 or vector[1] >= m-1 :
		if pos[1]-1 >=0 :
			pos[1] -= 1
			vector[0] = pos[0]
			vector[1] = pos[1]
		else:
			pos[0] += 1
			vector[0] = pos[0]
			vector[1] = pos[1] 
	else:
		vector[0] += 1
		vector[1] += 1